/*****************************************************************************
 *   Copyright 2011 ZHUANG Yuan              	                             *
 *   SudokuITS as Final Year Project for BScCS, City University of Hong Kong *
 *                                      									 *
 *   Licensed under the Apache License, Version 2.0 (the "License");         *
 *   you may not use this file except in compliance with the License.        *
 *   You may obtain a copy of the License at                                 *
 *                                                                           *
 *   http://www.apache.org/licenses/LICENSE-2.0                              *
 *                                                                           *
 *   Unless required by applicable law or agreed to in writing, software     *
 *   distributed under the License is distributed on an "AS IS" BASIS,       *
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.*
 *   See the License for the specific language governing permissions and     *
 *   limitations under the License.                                          *
 *****************************************************************************/

package android.sudoku.its.student;

import android.sudoku.its.util.GameVariables;

public class Student {
	private int id, age, sudokuExperience; 
	private int level;	// indicate student's Sudoku skill level: 0 - naive; 1 - beginner; 2 - intermediate; 3 - advanced
	// The following variables indicates student's mastery on each Sudoku strategy
	private int masteryOnFullHouse, masteryOnNakedSingle, masteryOnNakedPair, 
				masteryOnHiddenSingle, masteryOnHiddenPair, masteryOnLockedCandidates; 
	private String name, password, gender, educationLevel, subject;
	
	private final int DEFAULT_INTEGER_VALUE = 0; 
	private final String DEFAULT_STRING_VALUE = "";
	
	public Student() {
		this.id = DEFAULT_INTEGER_VALUE;
		this.age = DEFAULT_INTEGER_VALUE;
		this.name = GameVariables.USER_TITLE_GUEST;
		this.password = DEFAULT_STRING_VALUE;
		this.gender = DEFAULT_STRING_VALUE;		
		this.sudokuExperience = DEFAULT_INTEGER_VALUE;
		this.level = DEFAULT_INTEGER_VALUE;
		this.educationLevel = DEFAULT_STRING_VALUE;
		this.subject = DEFAULT_STRING_VALUE;
		this.masteryOnFullHouse = DEFAULT_INTEGER_VALUE;
		this.masteryOnNakedSingle = DEFAULT_INTEGER_VALUE;
		this.masteryOnNakedPair = DEFAULT_INTEGER_VALUE;
		this.masteryOnHiddenSingle = DEFAULT_INTEGER_VALUE;
		this.masteryOnHiddenPair = DEFAULT_INTEGER_VALUE;
		this.masteryOnLockedCandidates = DEFAULT_INTEGER_VALUE;		
	}
	
	public Student(int id, String name, String password, String gender, 
			int age, int sudokuExperience, int level, String educationLevel, String subject,  
			int masteryOnFullHouse, int masteryOnNakedSingle, int masteryOnNakedPair, 
			int masteryOnHiddenSingle, int masteryOnHiddenPair, int masteryOnLockedCandidates
			) {
		this.id = id;
		this.age = age;
		this.name = name;
		this.password = password;
		this.gender = gender;		
		this.sudokuExperience = sudokuExperience;
		this.level = level;
		this.educationLevel = educationLevel;
		this.subject = subject;
		this.masteryOnFullHouse = masteryOnFullHouse;
		this.masteryOnNakedSingle = masteryOnNakedSingle;
		this.masteryOnNakedPair = masteryOnNakedPair;
		this.masteryOnHiddenSingle = masteryOnHiddenSingle;
		this.masteryOnHiddenPair = masteryOnHiddenPair;
		this.masteryOnLockedCandidates = masteryOnLockedCandidates;
	}
	
	public Student(String name, String password, String gender, 
			int age, int sudokuExperience, int level, String educationLevel, String subject, 
			int masteryOnFullHouse, int masteryOnNakedSingle, int masteryOnNakedPair, 
			int masteryOnHiddenSingle, int masteryOnHiddenPair, int masteryOnLockedCandidates
			) {
		this.age = age;
		this.name = name;
		this.password = password;
		this.gender = gender;		
		this.sudokuExperience = sudokuExperience;
		this.level = level;
		this.educationLevel = educationLevel;
		this.subject = subject;
		this.masteryOnFullHouse = masteryOnFullHouse;
		this.masteryOnNakedSingle = masteryOnNakedSingle;
		this.masteryOnNakedPair = masteryOnNakedPair;
		this.masteryOnHiddenSingle = masteryOnHiddenSingle;
		this.masteryOnHiddenPair = masteryOnHiddenPair;
		this.masteryOnLockedCandidates = masteryOnLockedCandidates;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public int getSudokuExperience() {
		return sudokuExperience;
	}

	public void setSudokuExperience(int sudokuExperience) {
		this.sudokuExperience = sudokuExperience;
	}
	
	public void updateSudokuExperience() {
		this.sudokuExperience ++;
		updateStudentLevel();
	}	
	
	private void updateStudentLevel() {				
		if (sudokuExperience > GameVariables.LEVEL_INTERMEDIATE_THRESHOLD)
			setLevel(GameVariables.LEVEL_ADVANCED);
		else if (sudokuExperience > GameVariables.LEVEL_BEGINNER_THRESHOLD)
			setLevel(GameVariables.LEVEL_INTERMEDIATE);
	}	

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}
	
	public String getEducationLevel() {
		return educationLevel;
	}

	public void setEducationLevel(String educationLevel) {
		this.educationLevel = educationLevel;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public int getMasteryOnFullHouse() {
		return masteryOnFullHouse;
	}

	public void setMasteryOnFullHouse(int masteryOnFullHouse) {
		this.masteryOnFullHouse = masteryOnFullHouse;
	}
	
	public void updateMasteryOnFullHouse() {
		this.masteryOnFullHouse ++;
	}

	public int getMasteryOnNakedSingle() {
		return masteryOnNakedSingle;
	}

	public void setMasteryOnNakedSingle(int masteryOnNakedSingle) {
		this.masteryOnNakedSingle = masteryOnNakedSingle;
	}
	
	public void updateMasteryOnNakedSingle() {
		this.masteryOnNakedSingle ++;
	}

	public int getMasteryOnNakedPair() {
		return masteryOnNakedPair;
	}

	public void setMasteryOnNakedPair(int masteryOnNakedPair) {
		this.masteryOnNakedPair = masteryOnNakedPair;
	}
	
	public void updateMasteryOnNakedPair() {
		this.masteryOnNakedPair ++;
	}

	public int getMasteryOnHiddenSingle() {
		return masteryOnHiddenSingle;
	}

	public void setMasteryOnHiddenSingle(int masteryOnHiddenSingle) {
		this.masteryOnHiddenSingle = masteryOnHiddenSingle;
	}
	
	public void updateMasteryOnHiddenSingle() {
		this.masteryOnHiddenSingle ++;
	}

	public int getMasteryOnHiddenPair() {
		return masteryOnHiddenPair;
	}

	public void setMasteryOnHiddenPair(int masteryOnHiddenPair) {
		this.masteryOnHiddenPair = masteryOnHiddenPair;
	}
	
	public void updateMasteryOnHiddenPair() {
		this.masteryOnHiddenPair ++;
	}

	public int getMasteryOnLockedCandidates() {
		return masteryOnLockedCandidates;
	}

	public void setMasteryOnLockedCandidates(int masteryOnLockedCandidates) {
		this.masteryOnLockedCandidates = masteryOnLockedCandidates;
	}
	
	public void updateMasteryOnLockedCandidate() {
		this.masteryOnLockedCandidates ++;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}	
}
